<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link id="easyuiTheme" rel="stylesheet" type="text/css"	href="${pageContext.request.contextPath }/js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/default.css">
<link href="${pageContext.request.contextPath }/js/kindeditor-4.1.10/themes/default/default.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/ajaxfileupload.js"></script>
<script src="${pageContext.request.contextPath }/js/common.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath }/js/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath }/js/kindeditor-4.1.10/kindeditor-all-min.js"></script>
<script	src="${pageContext.request.contextPath }/js/easyui/locale/easyui-lang-zh_CN.js"	type="text/javascript"></script>
</head>


<body>
<div style="padding:10px 10px 10px 10px" id="articleEditFormDiv">

	<form id="articleEditForm" class="itemForm" method="post" enctype="multipart/form-data">
	    <table cellpadding="5">
	    			<input type="hidden" name="id" />
	        <tr>
	            <td>标题:</td>
	            <td><input class="easyui-validatebox" required="true" type="text" name="title"  style="width: 280px;"/></td>
	        </tr>
	        <tr>
	            <td>分类:</td>
	            <td>
	            	<input class="easyui-validatebox" required="true" type="hidden" name="cid" style="width: 280px;"/>
	            	<a href="javascript:void(0)" class="easyui-linkbutton selectNewsCat">选择分类</a>
	            </td>
	        </tr>
	        <tr>
	            <td>编辑人:</td>
	            <td><input class="easyui-validatebox"  type="text" name="editor" style="width: 280px;"/></td>
	        </tr>
	        <tr>
	            <td>来源:</td>
	            <td><input class="easyui-validatebox"  type="text" name="source" style="width: 280px;"/></td>
	        </tr>
	        <tr>
	            <td>概要:</td>
	           <td> <textarea  rows="5" name="summary" class="textarea easyui-validatebox" required="true" style="height:200px;width: 280px;"></textarea></td>
	        </tr>
			<%--
	        <tr>
	            <td>关键字:</td>
	            <td><input class="easyui-validatebox"  type="text" name="keywords" style="width: 280px;"/></td>
	        </tr>
			--%>

			<tr>
				<td>发布时间:</td>
				<td>
					<%--<input id="dd" type="text" class="easyui-datebox" required="required" name="createDate" style="width: 280px;">--%>
					<input class="easyui-datetimebox" name="createDate" data-options="required:true,showSeconds:true" required="true" style="width:150px">
			</tr>

	         <tr>
	            <td>视频地址:</td>
	            <td>
	            	<input id="videoUrl" type="input" name="videoUrl" style="width: 800px; value=""/>	
	            </td>
	            
	        </tr>
	        <tr>
	            <td></td>
	            <td>
	            	<input type="file" id="uploadFile" name="uploadFile" accept=".avi,.wmv,.mpeg,.mp4,.mov,.mkv,.flv,.f4v,.m4v,.rmvb,.rm,.3gp,.dat,.ts,.mts,.vob">
	            </td>
	            
	        </tr>
	        <tr>
	            <td></td>
	            <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="uploadVideo();">上传视频</a></td>
	        </tr>
	        
	        
	        
	        <tr>
	            <td>图片:</td>
	            <td>
	            	 <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearImg()">清空图片</a>
	            	 <a href="javascript:void(0)" class="easyui-linkbutton picFileUpload">上传图片</a>
	                 <input id="imgUrl" type="hidden" name="imgUrl"/>
	            </td>
	        </tr>
	        <tr>
	            <td>详情:</td>
	            <td>
	                <textarea style="width:800px;height:500px;visibility:hidden;" name="content"></textarea>
	            </td>
	        </tr>
	    </table>
	</form>
	<div style="padding:5px">
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
	</div>
</div>
<script type="text/javascript">
	//清空图片组件
	function clearImg(){
		//选择图片全部清除
    	$(".pics ul li").remove();
    	//清空原有值
    	$("#imgUrl").val("");
	}

	function submitForm() {
		//有效验证
		if (!$('#articleEditForm').form('validate')) {
			$.messager.alert('提示', '表单还未填写完成!');
			return;
		}
		
		//提交表单
		$.post("${pageContext.request.contextPath}/article/update", $(
				"#articleEditForm").serialize(), function(data) {
			if (data.status == 200) {
				$.messager.alert('提示', '修改成功!', 'info', function() {
					$("#articleEditWindow").window('close');
					$("#articleList").datagrid("reload");
				});
			}
		});
	}
	function uploadVideo(){
		if($('#uploadFile').val() == ''){
			$.messager.alert('提示','您还没有选择要上传的文件！');
			return false;
		}
		beforeSend();
		upload();
	}
	
	function beforeSend() {
		//var h = document.body.clientHeight; 
		var h = $('#articleEditFormDiv').width();
		$("<div class=\"datagrid-mask\"></div>").css({display:"block",width:"100%",height:h}).appendTo($('#articleEditFormDiv')); 
		$("<div class=\"datagrid-mask-msg\"></div>").html("正在上传数据，请稍候。。。").appendTo($('#articleEditFormDiv')).css({display:"block", 
		left:($(document.body).outerWidth(true) - 190) / 2, 
		top:(h - 45) / 2}); 

		}
	
</script>

</body>


